<header class="uc_head">
	<h3>{echo:ILang::get('订单详情')}</h3>
</header>

<section class="order_schedule">
	<ol>
		{set:$orderStep = Order_Class::orderStep($this->order_info)}
		{foreach:items=$orderStep item=$stepData key=$eventTime}
		<li>{$eventTime}&nbsp;&nbsp;<span class="black">{$stepData}</span></li>
		{/foreach}
	</ol>
	<p>
		<strong>{echo:ILang::get('订单号')}：</strong>{$this->order_info['order_no']}
		<strong>{echo:ILang::get('下单日期')}：</strong>{$this->order_info['create_time']}
		<strong>{echo:ILang::get('状态')}：</strong>
		<span class="green bold">{echo:Order_Class::orderStatusText(Order_Class::getOrderStatus($this->order_info))}</span>
	</p>

	<p>
		{if:order_class::isCancel($this->order_info)}
		<label class="btn btn_orange">
			<input type="button" value="{echo:ILang::get('取消订单')}" onclick="window.location.href='{url:/ucenter/order_status/order_id/$this->order_info['order_id']/op/cancel}';" />
		</label>
		{/if}

		{if:order_class::isGoPay($this->order_info)}
		<label class="btn btn_green">
			<input type="button" value="{echo:ILang::get('立即付款')}" onclick="art.dialog.open('{url:/block/pay/id/$this->order_info['order_id']/payment/$this->order_info['pay_type']}',{title:'{echo:ILang::get('选择支付方式')}'})" />
		</label>
		{/if}

		{if:order_class::isConfirm($this->order_info)}
		<label class="btn btn_green">
			<input type="button" value="{echo:ILang::get('确认收货')}" onclick="window.location.href='{url:/ucenter/order_status/order_id/$this->order_info['order_id']/op/confirm}';" />
		</label>
		{/if}

		{if:order_class::isRefund($this->order_info)}
		<label class="btn btn_orange">
			<input type="button" value="{echo:ILang::get('申请售后')}" onclick='window.location.href="{url:/ucenter/refunds_edit/order_id/$this->order_info['order_id']}"' />
		</label>
		{/if}
	</p>
</section>

{if:$this->order_info['type'] == 'assemble' && $assemRow = Api::run('getAssembleCommanderByOrderNo',['order_no' => $this->order_info['order_no']])}
{set:$assemPer = $assemRow['member_nums']/$assemRow['limit_nums']*100}
<style type="text/css">
.progress-wrap {
    width:100%;
    background: #eee;
    height:15px;
    border: solid 1px #bbb;
    border-radius: 8px 8px;
}
.bar {
    background: #ff410f;
    height: 15px;
    border-radius: 8px 8px;
}
</style>
<!--拼团活动-->
<header class="uc_head">
	<h3>{echo:ILang::get('拼团分享')}</h3>
</header>
<section class="col_table">
    <table>
	    <tr>
	        <th>{echo:ILang::get('拼团状态')}：</th>
	        <td>
                <div class="progress-wrap">
                    <div class="bar progress" style="width:{$assemPer}%;"></div>
                </div>
                {if:$assemRow['is_finish'] == 1}
				{echo:ILang::get('恭喜您拼团成功')}
                {elseif:$assemRow['is_pay'] == 1}
                {$assemRow['limit_nums']}人成团，还差：{echo:$assemRow['limit_nums']-$assemRow['member_nums']}，

                {set:$shareUrl=Active::assembleUrl($this->order_info['order_no'])}
                <a href="{$shareUrl}" class="blue" target="_blank">{echo:ILang::get('立即邀请好友加团')}</a>

                {set:$shareUrl=urlencode($shareUrl)}
                <img src='{url:/pic/qrcode?data=$shareUrl}' width='100px' />
                {else:}
				{echo:ILang::get('付款后邀请更多好友加团')}
                {/if}
	        </td>
	    </tr>
    </table>
</section>
{/if}

{if:goods_class::isDelivery($this->order_info['goods_type'])}
<header class="uc_head">
	<h3>{echo:ILang::get('收件人信息')}</h3>
</header>
<section class="col_table">
	<table>
		<tr>
			<th>{echo:ILang::get('收货人')}：</th>
			<td>{$this->order_info['accept_name']}</td>
		</tr>
		<tr>
			<th>{echo:ILang::get('地址')}：</th>
			<td>{$this->order_info['province_str']} {$this->order_info['city_str']} {$this->order_info['area_str']} {$this->order_info['address']}</td>
		</tr>
		<tr>
			<th>{echo:ILang::get('邮编')}：</th>
			<td>{$this->order_info['postcode']}</td>
		</tr>
		<tr>
			<th>{echo:ILang::get('固定电话')}：</th>
			<td>{$this->order_info['telphone']}</td>
		</tr>
		<tr>
			<th>{echo:ILang::get('手机号码')}：</th>
			<td>{$this->order_info['mobile']}</td>
		</tr>
	</table>
</section>
{elseif:$this->order_info['goods_type'] == 'code'}
<header class="uc_head">
	<h3>{echo:ILang::get('验证码信息')}</h3>
</header>
<section class="col_table">
	<table>
		<tr>
			<th>{echo:ILang::get('消费验证码')}：</th>
			<td>
			    {foreach:items=Api::run('getOrderCodeByOrderId',array('id' => $this->order_info['order_id'])) item=$codeRow}
			    <p>{$codeRow['code']} [{if:$codeRow['is_used']}{echo:ILang::get('已使用')}:{$codeRow['use_time']}{else:}{echo:ILang::get('未使用')}{/if}]</p>
			    {/foreach}
			    {if:!isset($codeRow)}{echo:ILang::get('付款后自动显示')}{/if}
			</td>
		</tr>
	</table>
</section>
{elseif:$this->order_info['goods_type'] == 'download'}
<header class="uc_head">
	<h3>{echo:ILang::get('文件信息')}</h3>
</header>
<section class="col_table">
	<table>
		<tr>
			<th>{echo:ILang::get('文件下载')}：</th>
			<td>
			    {foreach:items=Api::run('getOrderDownloadByOrderId',array('id' => $this->order_info['order_id'])) item=$downloadRow}
                <p><a href="{url:/ucenter/download/id/$downloadRow['id']}" class="orange">{echo:ILang::get('点击下载')}</a> [{echo:ILang::get('已下载')}：{$downloadRow['num']}/{$downloadRow['limit_num']}] - {$downloadRow['end_time']}</p>
			    {/foreach}
			    {if:!isset($downloadRow)}{echo:ILang::get('付款后自动显示')}{/if}
			</td>
		</tr>
	</table>
</section>
{elseif:$this->order_info['goods_type'] == 'preorder'}
<!--预订信息-->
{foreach:items=Api::run('getOrderPreorderByOrderId',array('id' => $this->order_info['order_id'])) item=$preorderRow}
<header class="uc_head">
	<h3>{echo:ILang::get('预订信息')}</h3>
</header>
<section class="col_table">
	<table>
		<tr>
			<th>{echo:ILang::get('预订日期')}：</th>
			<td>{$preorderRow['start_date']}——{$preorderRow['end_date']}</td>
		</tr>
	</table>
</section>
{/foreach}
{/if}

<header class="uc_head">
	<h3>{echo:ILang::get('支付及配送方式')}</h3>
</header>
<section class="col_table">
	<table>
		<tr>
			<th>{echo:ILang::get('支付方式')}：</th>
			<td>{$this->order_info['payment']}</td>
		</tr>

		{if:$this->order_info['distribution']}
		<tr>
			<th>{echo:ILang::get('配送方式')}：</th>
			<td>{$this->order_info['delivery']}</td>
		</tr>

		<tr>
			<th>{echo:ILang::get('运费')}：</th>
			<td>{$this->order_info['real_freight']}</td>
		</tr>
		{/if}

		{if:$this->order_info['takeself']}
		<tr>
			<th>{echo:ILang::get('自提地址')}：</th>
			<td>
				{$this->order_info['takeself']['province_str']}
				{$this->order_info['takeself']['city_str']}
				{$this->order_info['takeself']['area_str']}
				{$this->order_info['takeself']['address']}
			</td>
		</tr>
		<tr>
			<th>{echo:ILang::get('自提联系方式')}：</th>
			<td>
				{echo:ILang::get('座机')}：{$this->order_info['takeself']['phone']} &nbsp;&nbsp;
				{echo:ILang::get('手机')}：{$this->order_info['takeself']['mobile']}
			</td>
		</tr>
		<tr>
			<th>{echo:ILang::get('自提码')}：</th>
			<td>{$this->order_info['checkcode']}</td>
		</tr>
		{else:}
		<tr>
			<th>{echo:ILang::get('物流公司')}：</th>
			<td>{$this->order_info['freight']['freight_name']}</td>
		</tr>
		<tr>
			<th>{echo:ILang::get('快递单号')}：</th>
			<td>{$this->order_info['freight']['delivery_code']}</td>
		</tr>
		{/if}

		{if:$this->order_info['paynote']}
		<tr>
			<th>{echo:ILang::get('支付说明')}：</th>
			<td>{$this->order_info['paynote']}</td>
		</tr>
		{/if}
	</table>
</section>

{if:$this->order_info['invoice']==1}
<header class="uc_head">
	<h3>{echo:ILang::get('发票信息')}</h3>
</header>
<section class="col_table">
	<table>
		<tr>
			<th>{echo:ILang::get('所需税金')}：</th>
			<td>{$this->order_info['taxes']}</td>
		</tr>
		<tr>
			<th>{echo:ILang::get('发票抬头')}：</th>
			<td>{echo:CountSum::invoiceText($this->order_info['invoice_info'])}</td>
		</tr>
	</table>
</section>
{/if}

<header class="uc_head">
	<h3>{echo:ILang::get('商品清单')}</h3>
</header>

<section class="uc_table">
	<table>
		<thead>
			<tr>
				<th>{echo:ILang::get('图片')}</th>
				<th>{echo:ILang::get('商品名称')}</th>
				<th>{echo:ILang::get('赠送积分')}</th>
				<th>{echo:ILang::get('商品价格')}</th>
				<th>{echo:ILang::get('优惠金额')}</th>
				<th>{echo:ILang::get('商品数量')}</th>
				<th>{echo:ILang::get('小计')}</th>
				<th>{echo:ILang::get('状态')}</th>
			</tr>
		</thead>
		<tbody>
			{foreach:items=Api::run('getOrderGoodsListByGoodsid',array('#order_id#',$this->order_info['order_id'])) item=$good}
			{set:$good_info = JSON::decode($good['goods_array'])}

			<tr>
				<td><img class="pro_pic" src="{url:$good['img']}" width="50px" height="50px" /></td>
				<td class="t_l">
					<a class="blue" href="{url:/site/products/id/$good['goods_id']}" target='_blank'>{$good_info['name']}</a>
					{if:$good_info['value']!=''}<p>{$good_info['value']}</p>{/if}
				</td>
				<td>{echo:$good['point']*$good['goods_nums']}</td>
				<td class="red2">￥{$good['goods_price']}</td>
				<td class="red2">￥{echo:$good['goods_price']-$good['real_price']}</td>
				<td>x {$good['goods_nums']}</td>
				<td class="red2 bold">￥{echo:$good['goods_nums']*$good['real_price']}</td>
				<td>
					{echo:Order_Class::goodsSendStatus($good)}
					{if:$good['delivery_id']}
					<a onclick='freightLine({$good['delivery_id']});'>{echo:ILang::get('查看物流')}</a>
					{/if}
				</td>
			</tr>
			{/foreach}
			<tr>
				<td colspan="8" class="tr">
					<p>商品总金额：￥{$this->order_info['payable_amount']}</p>

					{if:$this->order_info['real_freight'] > 0}
					<p>+ {echo:ILang::get('运费')}：￥{$this->order_info['real_freight']}
					{/if}

					{if:$this->order_info['taxes'] > 0}
					<p>+ {echo:ILang::get('税金')}：￥{$this->order_info['taxes']}</p>
					{/if}

					{if:$this->order_info['insured'] > 0}
					<p>+ {echo:ILang::get('保价')}：￥{$this->order_info['insured']}</p>
					{/if}

					<p>{echo:ILang::get('订单折扣或涨价')}：￥{$this->order_info['discount']}</p>

					{if:$this->order_info['promotions'] > 0}
					<p>- {echo:ILang::get('促销优惠金额')}：￥{$this->order_info['promotions']}</p>
					{/if}

		            {if:$this->order_info['spend_point'] > 0}
		            <p>- {echo:ILang::get('消耗积分')}：{$this->order_info['spend_point']} {echo:ILang::get('积分')}</p>
		            {/if}
					<p>{echo:ILang::get('订单支付金额')}：<span class="red">￥<label>{$this->order_info['order_amount']}</label></span></p>
				</td>
			</tr>
		</tbody>
	</table>
</section>

<script>
//快递跟踪
function freightLine(doc_id){
	var urlVal = "{url:/block/freight/id/@id@}";
	urlVal = urlVal.replace("@id@",doc_id);
	art.dialog.open(urlVal,{'title':'{echo:ILang::get('轨迹查询')}',width:'600px',height:'500px'});
}
</script>
